Skip to content

fix: align env-check with platform-aware CodeQL paths and fix parity test filtering#57

Merged
pruiz merged 2 commits into
masterfrom
fix/env-check-codeql-path-and-parity-tests
Jun 12, 2026
Merged

fix: align env-check with platform-aware CodeQL paths and fix parity test filtering#57
pruiz merged 2 commits into
masterfrom
fix/env-check-codeql-path-and-parity-tests

Conversation

@pruiz

@pruiz pruiz commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Summary

CodeQL env-check path fix

  • codecome.yml: removed stale install.path so the platform-aware default from tools/codeql/config.py takes effect (.tools/codeql/osx64/current/codeql on macOS, linux64/ on Linux)
  • Makefile: added UNAME_S / CODEQL_PLATFORM / CODEQL_BIN make variables derived from uname -s. The env-check tests exactly the host platform's managed binary path — no inline Python, no globs, no wildcard OR-chains. Also accepts CODEQL_INSTALL_PATH override as a make variable.
  • CI workflow: added make env-check after each make init step so the path check is exercised in PR builds
  • test_codeql_config.py: added test_install_path_defaults_to_platform_specific, with CODEQL_INSTALL_PATH env isolation

Parity test filtering fix

  • mock-llm-parity.py: renamed _SERVE_ONLY_TYPES_PARITY_IGNORED_TYPES, added plugin.added, plugin.updated, connector.updated, reference.updated to the ignored set. Removed the old-name alias — all call sites reference _PARITY_IGNORED_TYPES directly. Simplified compare_events() to call normalize_event() once per event via map.
  • test_mock_llm_parity.py: updated test to iterate the renamed constant

Why CI didn't catch the env-check bug

CI ran make init then directly invoked pytest and check-frontmatter.py, bypassing make env-check which is the prerequisite for all make targets like make tests, make check, and all phases.

Test results

  • 815 passed, 0 failed (pytest)
  • 16/16 parity tests pass
  • Frontmatter gate: 25 findings OK
  • make env-check passes on macOS (local) and all CI matrix jobs

…test filtering

Remove stale install.path from codecome.yml so the platform-aware default
(.tools/codeql/<plat>/current/codeql) takes over from config.py.

Replace hardcoded env-check path with explicit platform checks covering
old (current/) and new (osx64/, linux64/, win64/) install layouts.

Add make env-check step after each make init in CI so the path check is
exercised in PR builds.

Add plugin.added, plugin.updated, connector.updated, and reference.updated
to the parity-ignored event set in mock-llm-parity.py (renamed from
_SERVE_ONLY_TYPES to _PARITY_IGNORED_TYPES). Simplify compare_events()
to call normalize_event once per event via map.

Add test_install_path_defaults_to_platform_specific config test.
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR transitions CodeQL installation from explicit path references to managed installation, validates the setup across platform-specific directories, and optimizes mock LLM parity event filtering by consolidating ignored event types and improving normalization efficiency.

Changes

CodeQL Managed Installation Integration

Layer / File(s) Summary
Managed CodeQL Configuration
codecome.yml
Updated static_analysis.codeql to use managed installation with version: "latest" instead of explicit path.
Installation Path Validation Test
tests/test_codeql_config.py
New test verifies resolve_config().install_path defaults to platform-specific managed directory containing .tools/codeql/ and ending in /current/codeql.
Multi-Platform Makefile Verification
Makefile
Enhanced env-check to validate CodeQL managed binary across current, osx64, linux64, and win64 platform directories instead of only current.
CI Verification Workflow Steps
.github/workflows/tests.yml
Added conditional verification steps: full CodeQL install for Python 3.14 and skip-install for all other versions, each with corresponding make env-check validation.

Mock LLM Parity Event Filtering Optimization

Layer / File(s) Summary
Event Type Configuration and Normalization Optimization
tools/mock-llm-parity.py, tests/test_mock_llm_parity.py
Defined _PARITY_IGNORED_TYPES constant with expanded volatile plugin/connector/reference update events, made _SERVE_ONLY_TYPES a legacy alias, and refactored compare_events() to normalize via single map() call instead of redundant per-event calls. Updated corresponding test to drive assertions from the new constant.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A managed CodeQL hops along,
Platform checks grow strong,
Paths are tested, verified true,
Events filter, fast and new!
Tests ensure all's in place,
Configuration keeps the pace! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: align env-check with platform-aware CodeQL paths and fix parity test filtering' accurately reflects the two main changes: aligning env-check validation with platform-specific CodeQL paths and correcting parity test filtering logic.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/env-check-codeql-path-and-parity-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

Coverage Report

Metric Value
Line Coverage 75.9%
Lines Covered 0 / 0

Download detailed HTML coverage reports per OS/Python from the workflow artifacts.

Generated by pytest-cov on 2026-06-12T19:44:11.293Z

@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes two independent issues: (1) a stale hardcoded CodeQL install path in codecome.yml that prevented the platform-aware default in tools/codeql/config.py from taking effect, and (2) missing event types in the parity test filter that caused spurious test failures.

  • Makefile / codecome.yml: Removes the hardcoded path: \".tools/codeql/current/codeql\" from YAML and replaces the env-check target's hardcoded path with a platform-derived $(CODEQL_BIN) variable (using uname -s to select osx64, linux64, or win64), bringing the Makefile in sync with what config.py already computed.
  • CI workflow: Inserts make env-check after each make init step so the binary-presence check is exercised in every PR build; the skip-install branch correctly relies on make init writing .tools/codeql/.disabled so the binary check is skipped.
  • mock-llm-parity.py: Renames _SERVE_ONLY_TYPES_PARITY_IGNORED_TYPES, adds volatile opencode startup events (plugin.added, plugin.updated, connector.updated, reference.updated), and avoids the double normalize_event() call in compare_events() via map.

Confidence Score: 5/5

Safe to merge — all changes are additive fixes with no regressions introduced.

The three change areas (YAML path removal, Makefile platform detection, parity filter expansion) are each narrow and well-tested. The .disabled file sentinel correctly decouples the skip-install CI branch from the env-check binary test. Platform detection in the Makefile (uname -s) and in Python (platform.system()) map to identical CodeQL directory names, so the two paths stay in sync.

No files require special attention.

Important Files Changed

Filename Overview
codecome.yml Removes stale install.path key so platform-aware default in config.py takes effect; one-line deletion, correct.
Makefile Adds platform detection via uname -s and replaces hardcoded .tools/codeql/current/codeql with $(CODEQL_BIN) in env-check; logic matches codeql_platform() in Python.
.github/workflows/tests.yml Adds make env-check after both make init variants; the skip-install branch is safe because init writes .tools/codeql/.disabled.
tests/test_codeql_config.py New test correctly monkeypatches ROOT and deletes CODEQL_INSTALL_PATH to exercise the platform-specific default path.
tools/mock-llm-parity.py Renames constant, expands ignored event set with volatile startup types, and eliminates double normalize_event() call via map; all changes are correct.
tests/test_mock_llm_parity.py Updates test to iterate _PARITY_IGNORED_TYPES instead of the renamed _SERVE_ONLY_TYPES; straightforward rename tracking.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[make init] -->|CODEQL_SKIP_INSTALL=1| B[write .tools/codeql/.disabled]
    A -->|CODEQL=0| B
    A -->|full install| C[install to .tools/codeql/PLATFORM/current/codeql]

    D[make env-check] --> E{.tools/codeql/.disabled exists?}
    E -->|Yes - skip| F[✅ CodeQL check skipped]
    E -->|No - check| G{test -x CODEQL_BIN}
    G -->|found| H[✅ Environment OK]
    G -->|missing| I[❌ FAIL: run make init]

    J[config.py resolve_config] --> K{CODEQL_INSTALL_PATH set?}
    K -->|Yes| L[use env var path]
    K -->|No| M{install.path in codecome.yml?}
    M -->|Yes - was stale path| N[❌ old layout path]
    M -->|No - after this PR| O[codeql_platform → osx64/linux64/win64]
    O --> P[.tools/codeql/PLATFORM/current/codeql]

    style N fill:#f99,stroke:#c00
    style P fill:#9f9,stroke:#090
    style H fill:#9f9,stroke:#090
    style F fill:#9f9,stroke:#090
Loading

Reviews (2): Last reviewed commit: "fix: derive CodeQL binary path from unam..." | Re-trigger Greptile

Comment thread tests/test_codeql_config.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tools/mock-llm-parity.py (1)

42-58: Clarify _SERVE_ONLY_TYPES “legacy alias” comment (and its usage)

  • In tools/mock-llm-parity.py, _SERVE_ONLY_TYPES is only defined at line 58 and used internally at line 345; no other in-repo references exist, so the line-57 comment about “external test references” is misleading—either clarify that it’s purely a backward-compat/internal alias, or switch the internal check to _PARITY_IGNORED_TYPES directly.
  • LGTM on the compare_events map/list-comprehension refactor (lines 413-414).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/mock-llm-parity.py` around lines 42 - 58, The comment claiming
_SERVE_ONLY_TYPES is a "Legacy alias kept for external test references" is
inaccurate because _SERVE_ONLY_TYPES is only defined here and only used
internally (e.g., in the check that references _SERVE_ONLY_TYPES); either update
the comment to state it's an internal/backwards-compatibility alias (mentioning
the symbols _SERVE_ONLY_TYPES and _PARITY_IGNORED_TYPES) or remove the alias and
change the internal usage to reference _PARITY_IGNORED_TYPES directly (so
replace uses of _SERVE_ONLY_TYPES with _PARITY_IGNORED_TYPES and delete the
alias definition).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/test_codeql_config.py`:
- Around line 55-71: The test test_install_path_defaults_to_platform_specific
must ensure the CODEQL_INSTALL_PATH env var is not set so resolve_config() uses
the platform default; before calling config_module.resolve_config(), remove or
unset CODEQL_INSTALL_PATH (use monkeypatch.delenv("CODEQL_INSTALL_PATH",
raising=False) or equivalent) to isolate the environment, then proceed to call
codeql.platform.codeql_platform() and config_module.resolve_config() and assert
on config.install_path.

---

Nitpick comments:
In `@tools/mock-llm-parity.py`:
- Around line 42-58: The comment claiming _SERVE_ONLY_TYPES is a "Legacy alias
kept for external test references" is inaccurate because _SERVE_ONLY_TYPES is
only defined here and only used internally (e.g., in the check that references
_SERVE_ONLY_TYPES); either update the comment to state it's an
internal/backwards-compatibility alias (mentioning the symbols _SERVE_ONLY_TYPES
and _PARITY_IGNORED_TYPES) or remove the alias and change the internal usage to
reference _PARITY_IGNORED_TYPES directly (so replace uses of _SERVE_ONLY_TYPES
with _PARITY_IGNORED_TYPES and delete the alias definition).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d6add3af-b38d-4661-aeb9-be976983523e

📥 Commits

Reviewing files that changed from the base of the PR and between cb06ce2 and d952069.

📒 Files selected for processing (6)
  • .github/workflows/tests.yml
  • Makefile
  • codecome.yml
  • tests/test_codeql_config.py
  • tests/test_mock_llm_parity.py
  • tools/mock-llm-parity.py
💤 Files with no reviewable changes (1)
  • codecome.yml

Comment thread tests/test_codeql_config.py
…nv, drop alias

Replace multi-platform OR-chain in env-check with uname-derived
CODEQL_PLATFORM (osx64/linux64/win64) and CODEQL_BIN. Accept
CODEQL_INSTALL_PATH override as a make variable.

Add monkeypatch.delenv for CODEQL_INSTALL_PATH in config test.

Remove _SERVE_ONLY_TYPES alias, use _PARITY_IGNORED_TYPES directly
in all call sites.

@pruiz pruiz left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review feedback addressed in 08e0114

_SERVE_ONLY_TYPES alias (CodeRabbit nitpick on tools/mock-llm-parity.py):
Removed the alias entirely. normalize_event() now references _PARITY_IGNORED_TYPES directly. Zero callers remain referencing the old name.

CODEQL_INSTALL_PATH isolation (Greptile + CodeRabbit inline comments on tests/test_codeql_config.py):
Added monkeypatch.delenv("CODEQL_INSTALL_PATH", raising=False) at the top of test_install_path_defaults_to_platform_specific.

Makefile complexity (my own review finding about the multi-platform OR-chain):
Replaced the four-path OR-chain with uname -s detection via make variables:

  • UNAME_S := $(shell uname -s)
  • CODEQL_PLATFORM — resolves to osx64 / linux64 / win64 (with MINGW/MSYS/CYGWIN fallbacks)
  • CODEQL_BIN := $(or $(CODEQL_INSTALL_PATH),.tools/codeql/$(CODEQL_PLATFORM)/current/codeql)

The env-check now tests exactly the host platform's managed binary path. No inline Python, no globs, no wildcards. Accepts CODEQL_INSTALL_PATH override as a make variable.

Docstring coverage warning (CodeRabbit pre-merge check):
Disregarded — not actionable for this PR.

Coverage comment showing 0/0 lines (GitHub Actions bot):
Pre-existing workflow issue unrelated to this PR.

Test results

  • 815 passed, 0 failed (pytest)
  • Frontmatter gate: 25 findings OK
  • make env-check passes on macOS (local) and all CI matrix jobs

@pruiz pruiz merged commit f0c0431 into master Jun 12, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant